
package com.huaweicloud.saaslanding.install.properties.idaas;

import com.alibaba.fastjson.JSONObject;
import com.huaweicloud.saaslanding.install.constant.ModelConstant;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import jakarta.validation.constraints.NotEmpty;

/**
 * 功能描述
 *
 * @since 2022-03-23
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Component
@Validated
@ConfigurationProperties(prefix = ModelConstant.ONEACCESS_USER_PREFIX)
public class IdaasUserProperties {
    /**
     * 用户id
     */
    private String userId;

    /**
     * 用户名
     */
    @NotEmpty(message = "用户名(oneaccess.user.userName)不能为空")
    private String userName;

    /**
     * 姓名
     */
    private String name;

    /**
     * 手机号
     */
    @NotEmpty(message = "用户名(oneaccess.user.mobile)不能为空")
    private String mobile;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 组织code
     */
    private String orgCode;

    /**
     * 组织Id
     */
    private String orgId;

    /**
     * 是否启用
     */
    private Boolean disabled;

    /**
     * 密码
     */
    @NotEmpty(message = "密码(oneaccess.user.password)不能为空")
    private String password;

    /**
     * 是否强制修改密码
     */
    private boolean pwdMustModify;

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }
}
